/*
 * Student.cpp
 *
 *  Created on: 11/03/2014
 *      Author: igor
 */

/*
 * Notas.cpp
 *
 *  Created on: 10/03/2014
 *      Author: igor
 */

#include "Student.h"
#include "stdio.h"
#include "string.h"
#include <iostream>
//#include "string.h"

using namespace std;
#define SIZE 20;

//const int numQuestoes = 20;

Student::Student() {


//	int startPosition = 0;
//	int namePosition = 0;
//	string Ident = 0;
//	int pontuacaoAluno = 0;
//	char* conceitoAluno = "null";
//	int length = 19;
//	char array[40] = "null";
//	printf("\nIgor");
}

Student::Student(Ident num) {
	m_Info[41] = '\0';
	this->m_line = num.numLines;
	this->m_length = num.length;
	this->m_namePosition = num.namePosition;
	this->m_respPosition = num.respPosition;
	this->m_register[11] = '\0';
	this->m_name[30] = '\0';
	this->m_resp[21] = '\0';
	this->m_value[21] = '\0';
	strcpy(this->m_Info, num.Info);
//	printf("\n[%d][%d]", num.namePosition, num.respPosition);
//	printf("\n%s ",this->m_Info);
//	printf("\nConstructor[%d][%d]", this->m_line, this->m_length);
}



Student::~Student() {
//	printf("\nNotas::Destructor\n");

	m_Info[41] = '\0';
	this->m_line = 0;
	this->m_length = 0;
	this->m_namePosition = 0;
	this->m_respPosition = 0;
//	fflush( stdout );
//	pontuacaoAluno = 0;
}

char Student::getResp(Ident num) {

	printf("\nStudent::getResp()\n");

	strncpy(m_resp, num.Info, 20);
	printf("%s \n",m_resp);
	return* m_resp;
}

char Student::getRegister(Ident num) {

//	printf("\nStudent::getRegister()\n");

	strncpy(m_register, num.Info, num.namePosition);
//	printf(" %s\n", m_register);

	return *m_register;
}

char Student::getName(Ident num) {
//	printf("\nStudent::getRegister()\n");
	for(int i=num.namePosition; i<num.respPosition;i++) {
		m_name[i-num.namePosition] = num.Info[i];
//		printf(" %c [%d]",num.Info[i]);
	}
	printf(" %s\n",m_name);
	return *m_name;
}

char Student::getValues(Ident num) {
	for(int i=num.respPosition; i<num.length; i++) {
//		printf(" %d",i-num.respPosition);
//		printf("%c",num.Info[i]);
//		printf("\n%c",m_resp[i-num.respPosition]);
		printf("[%c][%c] ",num.Info[i], m_resp[i-num.respPosition]);
	}
	return* m_value;
}
